public class copyArray {
    public static void main(String[] args){
        int[] a =  {1,22,3,4,5,66,77,88,9,0};
        int[] b = Copy(a, 1, 4);
        for(int i = 0; i < b.length; i++){
            System.out.print(b[i] + " ");
        }
    }
    public static int[] Copy(int[] arr, int from, int end){
        int length = end - from + 1;
        int[] newArray = new int[length];
        for(int i = 0; i < length; i++){
            newArray[i] = arr[from + i];
        }
        System.out.print("拷贝的数组是： [");
        for(int i = 0; i < newArray.length; i++){
            if(i == newArray.length - 1){
                System.out.print(newArray[i]);
            }
            else{
                System.out.print(newArray[i] + ", ");
            }
        }
        System.out.println("]");
        return newArray;
    }
}
